<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2008 XBRL International. All Rights Reserved. -->
<?xml-stylesheet type="text/xsl" href="../stylesheets/functionDefinition.xsl"?>
<function
  xmlns="http://xbrl.org/2008/function"
  xmlns:reg="http://xbrl.org/2008/registry"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns:xfi="http://www.xbrl.org/2008/function/instance" 
  xmlns:xfie="http://www.xbrl.org/2008/function/instance/error" 
  xmlns:xbrli="http://www.xbrl.org/2003/instance" 
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xsi:schemaLocation="
  http://xbrl.org/2008/registry ../schemas/registry.xsd
  http://xbrl.org/2008/function ../schemas/function.xsd
  ">

  <lastUpdated moment="2008-10-30T10:00:00" />

  <owners>
    <reg:owner id="herm">
       <reg:name>Herm Fischer</reg:name>
       <reg:affiliation>UBmatrix / Mark V Systems</reg:affiliation>
       <reg:email>fischer@markv.com</reg:email>
       <reg:assumedOwnership moment="2008-10-30T10:00:00" />
    </reg:owner>
  </owners>

  <summary>
    Returns true if both if and only if the two argument nodes are both attribute nodes that correspond or both element nodes that correspond. It returns a boolean value of false otherwise.
  </summary>

  <documentation>
<xhtml:p/>Two attribute nodes, A and B, are corresponding attributes if the following conditions are all satisfied: 
<xhtml:p/><xhtml:ul><xhtml:li>
A and B have the same name</xhtml:li><xhtml:li>
The sequences of atomic values obtained by atomizing A and B, As and Bs, are the same length and for each item Ai, at position i in As, the item Bi at position i in Bs, is such that the XPath 2.0 expression (Ai eq Bi) evaluates to an effective Boolean value of true when using the empty sequence as the context item. </xhtml:li><xhtml:li>
Note that if the attribute nodes, A and B, both atomize to empty sequences then those attribute nodes correspond. </xhtml:li></xhtml:ul>
<xhtml:p/>
Two element nodes, A and B, are corresponding elements if the following conditions are all satisfied: 
<xhtml:p/><xhtml:ul><xhtml:li>
A and B have the same name </xhtml:li><xhtml:li>
The sequences of atomic values obtained by atomizing A and B, As and Bs, are the same length and for each item Ai, at position i in As, the item Bi at position i in Bs, is such that the XPath 2.0 expression (Ai eq Bi) evaluates to an effective Boolean value of true when using the empty sequence as the context item. </xhtml:li><xhtml:li>
A and B have the same number of attributes</xhtml:li><xhtml:li>
For each non-id attribute on element node A, there is a corresponding attribute on element node B.</xhtml:li><xhtml:li>
A and B have the same number of child elements. </xhtml:li><xhtml:li>
For each child element of element node A, Ac, there is a corresponding child element of element node B, Bc, such that Ac and Bc have the same number of preceding sibling elements. </xhtml:li></xhtml:ul>
<xhtml:p/>
Note that, as for attribute nodes, if the element nodes, A and B, both atomize to empty sequences then those element nodes correspond. 


  </documentation>

  <signature name="xfi:nodes-correspond">
    <input name="left-node" type="node()">
      <xhtml:p>
        The first node argument.
      </xhtml:p>
    </input>
    <input name="right-node" type="node()">
      <xhtml:p>
        The second node argument.
      </xhtml:p>
    </input>
    <output type="xs:boolean">
      <xhtml:p>
    True if both if and only if left and right nodes are both attribute nodes that correspond or both element nodes that correspond; false otherwise.
      </xhtml:p>
    </output>
  </signature>

  <conformanceTest xlink:type="simple" xlink:href="80219 xfi.nodes-correspond testcase.xml"/>

  <revisions>
    <reg:revision on="2008-10-30T10:00:00" by="herm">
      <xhtml:p>
        Created
      </xhtml:p>      
    </reg:revision>
    <reg:revision on="2010-09-12T10:00:00" by="herm">
      <xhtml:p>
        Added "non-id" to attributes that must correspond, to permit use of this function for
        the aspect test of units.
      </xhtml:p>      
    </reg:revision>
  </revisions>

</function>
